﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BotonJXC.Util
{
    public class StatusUtil
    {
        /// <summary>
        /// 审核状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getAuditString(Int32 status) {
            string returnestatus = "";
            if (status == (Int32)Status.None)
            {
                returnestatus = "未审核";
            }
            else if (status == (Int32)Status.AuditPass)
            {

                returnestatus = "已审核";

            }else if (status == (Int32)Status.AuditNoPass)
            {

                returnestatus = "拒审";

            }else if (status == (Int32)Status.Revert)
            {

                returnestatus = "回转";
                
            }
            return returnestatus;
        }

        /// <summary>
        /// 审核状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getSettleAccountsString(Int32 status)
        {
            string returnestatus = "";
            if (status == (Int32)Status.None)
            {
                returnestatus = "未审核";
            }
            else if (status == (Int32)Status.AuditPass)
            {

                returnestatus = "通过";

            }
            else if (status == (Int32)Status.AuditNoPass)
            {

                returnestatus = "拒审";

            }
            else if (status == (Int32)Status.Revert)
            {

                returnestatus = "回转";

            }
            return returnestatus;
        }


        public static string getSettleAccountTypeString(string type) 
        {
            string result = null;
            if ("1".Equals(type))
            {
                result = "待结算款单";
            }
            else if("2".Equals(type)) 
            {
                result = "结算款单";
            }
            return result;
        } 
        /// <summary>
        /// 订单类型
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getOrdersTypeString(Int32 status)
        {
            string returnestatus = "";
            if (status == 1)
            {
                returnestatus = "分店订货单";
            }
            else if (status == 2)
            {

                returnestatus = "配送中心采购订单";

            }
            else if (status == 3)
            {

                returnestatus = "配送中心供应商订单";

            }
            else if (status == 4)
            {

                returnestatus = "采购中心采购订单";

            }
            return returnestatus;
        }
        /// <summary>
        /// 出库状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getOutString(Int32 status)
        {
            string returnestatus = "";
            if (status == (Int32)Status.None)
            {
                returnestatus = "未出库";
            }
            else if (status == (Int32)Status.AuditPass)
            {

                returnestatus = "已出库";

            }
            return returnestatus;
        }
        /// <summary>
        /// 入库状态
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getIntSring(Int32 status)
        {
            string returnestatus = "";
            if (status == (Int32)Status.None)
            {
                returnestatus = "未入库";
            }
            else if (status == (Int32)Status.AuditPass)
            {

                returnestatus = "已入库";

            }
            return returnestatus;
        }

        /// <summary>
        /// 调拨单类型
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static String getAllocateTypeString(Int32 status)
        {
            string returnestatus = "";
            if (status == 1)
            {
                returnestatus = "分店店内调拨";
            }
            else if (status == 2)
            {

                returnestatus = "分店同城调拨";

            }
            else if (status == 3)
            {

                returnestatus = "配送店内调拨";

            }
            else if (status == 4)
            {

                returnestatus = "加工间店内调拨";

            }
            else if (status == 5)
            {

                returnestatus = "配送行政领用";

            }
            return returnestatus;
        }
        public static string getOutStocksType( string outtype ){

            string type = "配送出库";
            if ("1".Equals(outtype))
            {
                type = "配送出库";
            }
            else if("2".Equals(outtype)) {
                type = "报损出库";
            }
            return type;
            
        }
        /// <summary>
        /// 更具单据名称
        /// </summary>
        /// <param name="OrderName"></param>
        /// <returns></returns>
        public static Dictionary<string, object> getOrderType(string OrderName)
        {
            Dictionary<string, object> myDic = new Dictionary<string, object>();  
            if ("分店订货单".Equals(OrderName)) {
              
                myDic.Add("OrderCode", 1);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 1);
            }
            else if ("配送中心采购订单".Equals(OrderName))
            {
                //1: 分店订货单 
                //2: 配送中心采购订单 
                //3: 配送中心供应商订单
                //4: 采购中心采购订单
                
                myDic.Add("OrderCode", 2);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 2);
            }
            else if ("配送中心供应商订单".Equals(OrderName))
            {
                myDic.Add("OrderCode", 3);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 3);
                
            }
            else if ("采购中心采购订单".Equals(OrderName))
            {
                myDic.Add("OrderCode", 4);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 2);
            }
            else if ("分店管理配送出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 5);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 1);
            }
            else if ("分店管理报损出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 6);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 2);
                
            }
            else if ("配送中心配送出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 7);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 1);
            }
            else if ("配送中心报损出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 8);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 2);
            }                
            else if ("加工间配送出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 9);
                myDic.Add("CreatePlace", 4);
                myDic.Add("OrderType", 1);
            }
            else if ("加工间报损出库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 10);
                myDic.Add("CreatePlace", 4);
                myDic.Add("OrderType", 2);
            }
            else if ("分店管理配送入库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 11);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 1);
            }
            else if ("配送中心配送入库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 12);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 1);
            }
            else if ("加工间配送入库".Equals(OrderName))
            {
                myDic.Add("OrderCode", 13);
                myDic.Add("CreatePlace", 4);
                myDic.Add("OrderType", 1);
            }
            else if ("分店店内调拨".Equals(OrderName))
            {
                myDic.Add("OrderCode", 14);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 1);
            }
            else if ("分店同城调拨".Equals(OrderName))
            {
                myDic.Add("OrderCode", 15);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 2);
            }
            else if ("配送店内调拨".Equals(OrderName))
            {

                myDic.Add("OrderCode", 16);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 3);
            }
            else if ("加工间店内调拨".Equals(OrderName))
            {
                myDic.Add("OrderCode", 17);
                myDic.Add("CreatePlace", 4);
                myDic.Add("OrderType", 4);
            }
            else if ("配送行政领用".Equals(OrderName))
            {
                myDic.Add("OrderCode", 18);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 5);
            }
            else if ("分店验收".Equals(OrderName))
            {
                myDic.Add("OrderCode", 19);
                myDic.Add("CreatePlace", 1);
                myDic.Add("OrderType", 3);
            }
            else if ("配送中心供应商验收 ".Equals(OrderName))
            {
                myDic.Add("OrderCode", 20);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 1);
            }
            else if ("配送中心采购验收".Equals(OrderName))
            {
                myDic.Add("OrderCode", 21);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 2);
            }
            else if ("配送中心退货单".Equals(OrderName))
            {
                myDic.Add("OrderCode", 22);
                myDic.Add("CreatePlace", 2);
                myDic.Add("OrderType", 1);
  
            }
            return myDic;
        }

        public static string getOrderTypeName(Int32 OrderCode)
        {
             string OrderTypeName = "";
             if (OrderCode == 0)
             {
                 OrderTypeName = "请选择";
             }
            if ( OrderCode == 1)
            {
                OrderTypeName = "分店订货单";
            }
            else if (OrderCode == 2)
            {
                //1: 分店订货单 
                //2: 配送中心采购订单 
                //3: 配送中心供应商订单
                //4: 采购中心采购订单

                OrderTypeName = "配送中心采购订单";
            }
            else if (OrderCode == 3)
            {
                OrderTypeName = "配送中心供应商订单";

            }
            else if (OrderCode == 4)
            {
                OrderTypeName = "采购中心采购订单";
            }
            else if (OrderCode == 5)
            {
                OrderTypeName = "分店管理配送出库";
            }
            else if (OrderCode == 6)
            {
                OrderTypeName = "分店管理报损出库";

            }
            else if (OrderCode == 7)
            {
                OrderTypeName = "配送中心配送出库";
            }
            else if (OrderCode == 8)
            {
                OrderTypeName = "配送中心报损出库";
            }
            else if (OrderCode == 9)
            {
                OrderTypeName = "加工间配送出库";
            }
            else if (OrderCode == 10)
            {
                OrderTypeName = "加工间报损出库";
            }
            else if (OrderCode == 11)
            {
                OrderTypeName = "分店管理配送入库";
            }
            else if (OrderCode == 12)
            {
                OrderTypeName = "配送中心配送入库";
            }
            else if (OrderCode == 13)
            {
                OrderTypeName = "加工间配送入库";
            }
            else if (OrderCode == 14)
            {
                OrderTypeName = "分店店内调拨";
            }
            else if (OrderCode == 15)
            {
                OrderTypeName = "分店同城调拨";
            }
            else if (OrderCode == 16)
            {
                OrderTypeName = "配送店内调拨";
            }
            else if (OrderCode == 17)
            {
                OrderTypeName = "加工间店内调拨";
            }
            else if (OrderCode == 18)
            {
                OrderTypeName = "配送行政领用";
            }
            else if (OrderCode == 19)
            {
                OrderTypeName = "分店验收";
            }
            else if (OrderCode == 20)
            {
                OrderTypeName = "配送中心供应商验收";
            }
            else if (OrderCode == 21)
            {
                OrderTypeName = "配送中心采购验收";
            }
            else if (OrderCode == 22)
            {
                OrderTypeName = "配送中心退货单";

            }
            return OrderTypeName;
        }

        //财务单
        public static string getFinanceBillsLogsSign( Int32 sign) {

            string logsSign = "";
            if ( sign == 1 )
            {
                logsSign = "未传";
            }
            else if (sign == 2)
            {
                logsSign = "已传";
            }
            else if (sign == 3)
            {
                logsSign = "未接";
            }
            else if (sign == 4)
            {
                logsSign = "已接";
            }

            return logsSign;
        }
          
    }
}
